#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    while (!cin.eof()){
        vector<int> ind, indcur;
        string s;
        cin>>s;
        //cout<<s<<endl;
        int n = s.length();
        int cnt[n];
        for(int i=0; i< n;i++)
            if (s[i] == s[0])
                ind.push_back(i);
        cnt[0] = ind.size();
        //cout<<s.substr(0,1)<< " " <<cnt[0]<<endl;
        for (int i = 1; i < n;i++){
            for (int k = 0;k<ind.size();k++){
                if (ind[k] < n-1 && s[ind[k] + 1] == s[i])
                    indcur.push_back(ind[k] + 1);
            }
            cnt[i] = indcur.size();
            ind = indcur;
            indcur.clear();
            //cout<<s.substr(0,i+1)<< " " <<cnt[i]<<endl;
        }
        int total = 0;
        for(int i=0; i< n;i++){
            total = (total + cnt[i]) % 256;
        }
        cout<<total;
        if(!cin.eof())
            cout<<endl;
    }
}
